package com.sservice.web.controller.admin;

import com.sservice.base.entity.dto.ListResult;
import com.sservice.base.entity.dto.Pagination;
import com.sservice.commonBusiness.e.DataR;
import com.sservice.model.vo.UserWxVo;
import com.sservice.service.service.IUserWxService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.servlet.http.HttpServletRequest;
import java.util.List;

@Controller
@RequestMapping("/admin/userWx")
public class UserWxController {
    private Logger logger = LoggerFactory.getLogger(this.getClass());

    @Autowired
    IUserWxService iUserWxService;
//    @Autowired
//    IUserService userService;


    @ResponseBody
    @RequestMapping(value = "/queryByDr", method = RequestMethod.GET)
    public ListResult queryPlain(DataR user) {

        List<UserWxVo> list = iUserWxService.queryDrLink(user);
        ListResult res = new ListResult(true, list);
        return res;
    }

    @ResponseBody
    @RequestMapping(value = "/queryPlain", method = RequestMethod.GET)
    public ListResult queryPlain(UserWxVo user, HttpServletRequest request) {

        List<UserWxVo> list = iUserWxService.queryPlainByPage(user);
        int total = iUserWxService.countPlainByPage(user);
        user.getPage();
        Pagination page = new Pagination(user.getPage(), total, user.getSize());
        ListResult res = new ListResult(true, list);
        res.setPage(page);
        return res;
    }


}
